home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / misc / GC$LatencyRequest.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  1.9 KB  |  78 lines

  1. package sun.misc;
  2.  
  3. import java.util.SortedSet;
  4. import java.util.TreeSet;
  5.  
  6. public class GC$LatencyRequest implements Comparable {
  7.    private static long counter = 0L;
  8.    private static SortedSet requests = null;
  9.    private long latency;
  10.    // $FF: renamed from: id long
  11.    private long field_0;
  12.  
  13.    private static void adjustLatencyIfNeeded() {
  14.       if (requests != null && !requests.isEmpty()) {
  15.          GC$LatencyRequest var0 = (GC$LatencyRequest)requests.first();
  16.          if (var0.latency != GC.access$200()) {
  17.             GC.access$500(var0.latency);
  18.          }
  19.       } else if (GC.access$200() != Long.MAX_VALUE) {
  20.          GC.access$500(Long.MAX_VALUE);
  21.       }
  22.  
  23.    }
  24.  
  25.    private GC$LatencyRequest(long var1) {
  26.       if (var1 <= 0L) {
  27.          throw new IllegalArgumentException("Non-positive latency: " + var1);
  28.       } else {
  29.          this.latency = var1;
  30.          synchronized(GC.access$100()) {
  31.             this.field_0 = ++counter;
  32.             if (requests == null) {
  33.                requests = new TreeSet();
  34.             }
  35.  
  36.             requests.add(this);
  37.             adjustLatencyIfNeeded();
  38.          }
  39.       }
  40.    }
  41.  
  42.    public void cancel() {
  43.       synchronized(GC.access$100()) {
  44.          if (this.latency == Long.MAX_VALUE) {
  45.             throw new IllegalStateException("Request already cancelled");
  46.          } else if (!requests.remove(this)) {
  47.             throw new InternalError("Latency request " + this + " not found");
  48.          } else {
  49.             if (requests.isEmpty()) {
  50.                requests = null;
  51.             }
  52.  
  53.             this.latency = Long.MAX_VALUE;
  54.             adjustLatencyIfNeeded();
  55.          }
  56.       }
  57.    }
  58.  
  59.    public int compareTo(Object var1) {
  60.       GC$LatencyRequest var2 = (GC$LatencyRequest)var1;
  61.       long var3 = this.latency - var2.latency;
  62.       if (var3 == 0L) {
  63.          var3 = this.field_0 - var2.field_0;
  64.       }
  65.  
  66.       return var3 < 0L ? -1 : (var3 > 0L ? 1 : 0);
  67.    }
  68.  
  69.    public String toString() {
  70.       return GC$LatencyRequest.class.getName() + "[" + this.latency + "," + this.field_0 + "]";
  71.    }
  72.  
  73.    // $FF: synthetic method
  74.    GC$LatencyRequest(long var1, GC.1 var3) {
  75.       this(var1);
  76.    }
  77. }
  78.